<!doctype html>
<html lang="en" style="font-size: 38.3333px;">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
  <title>
	邀请
</title>
  <link rel="stylesheet" href="./invitation/commen.css" />
  <link rel="stylesheet" href="./invitation/header.css" />
  <link rel="stylesheet" href="./invitation/style_invite.css" /> 
  <link href="./invitation/fakeLoader.css" rel="stylesheet" />
 <script src="https://cdn.bootcss.com/jquery/3.2.0/jquery.min.js"></script>
 <script src="../js/paramsTool.js"></script>
 <script src="../../js/layer.js"></script>
  <style>
      .btn_up_vip { 
        color:#fff;
        background:#ff5000;
        border-radius:2px;
        padding:0 0.32rem;
        font-size:0.375rem;
        line-height:0.8rem;
        margin-top:0.1rem;
        box-shadow: 3px 3px 3px #dbab28;
      }

      .layBtn{width: 90%;padding:10px 5%; margin-top: 10px; color: green;font-size: 15px; text-align: center; border: 1px solid green; border-radius: 5px; background:
              whitesmoke; font-weight: 500;}

    </style>

     <script>
         var params = queryString();
//         console.log('params:',JSON.stringify(params));
         var disOpenid = null,disUid = null,disVip = 0,disPoin = 0;
         if(params.disOpenid){
             disOpenid = params.disOpenid
         }else {
             disOpenid = getCookie('disOpenid')
         }
         if(params.disUid){
             disUid = params.disUid
         }else {
             disUid = getCookie('disUid');
         }

         if(params.disVip){
             disVip = params.disVip
         }else {
             disVip = getCookie('disVip');
         }

         if(params.disPoin){
             disPoin = params.disPoin
         }else {
             disPoin = getCookie('disPoin');
         }

//         if(!disOpenid || !disUid){
//             getDisWxCode();
//         }

        function shareLink(){
            location.href = host+'/distribution/view/shareLink.html?disOpenid='+disOpenid+'&disUid='+disUid;
        }

         var imgPath = '../disQR/' + disUid + '.png';
         $(document).ready(function() {
             $('#img').attr('src',imgPath).css({width:'100%',height:100,position:'fixed',display:'none'});
         });
         function createCode() {
             if(disOpenid && disUid){
                 $.ajax({
                     url: host + "/createDisQR",
                     type: "get",
                     dataType: 'json',
                     headers: {"content-type": "application/json", "disuid": disUid, 'disopenid': disOpenid}
                 });
             }
         };

         function openVip(){
             if(disVip == 1){
                 layer.open({
                     content: '您已经是VIP会员啦!'
                     , skin: 'msg'
                     , time: 1.5 //2秒后自动关闭
                 });
             }else {
                 layer.open({
                     content: '<input type="button" value="微信支付" class="layBtn" onclick="maPay()"><input type="button" value="积分支付" class="layBtn" style="color:orangered "  onclick="poinPay()">'
                     ,skin: 'footer'
                 });
             }
         }

         function poinPay(){

             if(disVip == 1){
                 layer.open({
                     content: '您已经是会员啦'
                     ,skin: 'msg'
                     ,time: 1.5 //2秒后自动关闭
                 });
             }else if(disPoin < 10){
                 layer.open({
                     content: '积分不足,请先充足积分再来吧'
                     ,skin: 'msg'
                     ,time: 1.5 //2秒后自动关闭
                 });
             }else {
                 $.ajax({
                     url: host+ "/disPoinPay",
                     type: "get",
                     async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                     dataType:'json',
                     headers: {"content-type":"application/json","disopenid":disOpenid},
                     success:function(data){
                         if(data.code){
                             layer.open({
                                 content: data.info
                                 , btn: ['朕知道了']
                                 , yes: function (index) {
                                     layer.close(index);
                                 }
                             });
                         }else {
                             disVip = 1;
                             disPoin -= 10;
                             setCookie('disPoin',disPoin);
                             setCookie('disVip',disVip);
                             refresh();
                             layer.open({
                                 content: '成为会员成功!'
                                 ,skin: 'msg'
                                 ,time: 1.5 //2秒后自动关闭
                             });
                         }
                     },
                     error:function() {
                         layer.open({
                             content: '异常错误!'
                             ,skin: 'msg'
                             ,time: 1.5 //2秒后自动关闭
                         });
                     }
                 });
             }

         }

         function maPay(){
             $.ajax({
                 url: host+ "/disMaPay",
                 type: "get",
                 async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                 dataType:'json',
                 headers: {"content-type":"application/json","disopenid":disOpenid,"disuid":disUid},
                 success:function(data){
                     if(data.payUrl){
                         location.href = data.payUrl;
                     }else {
                         layer.open({
                             content: '支付失败,请稍后再试!'
                             ,skin: 'msg'
                             ,time: 1.5 //2秒后自动关闭
                         });
                     }

                 },
                 error:function() {
                     layer.open({
                         content: '充值失败!'
                         ,skin: 'msg'
                         ,time: 1.5 //2秒后自动关闭
                     });
                 }
             });
         }


     </script>
 </head> 
 <body class="bg_face3c"> 
  <div class="fakeloader" style="position: fixed; width: 100%; height: 100%; top: 0px; left: 0px; background-color: rgb(255, 255, 255); z-index: 999; display: none;">
   <div class="fakeLoaderfl spinner6" style="position: absolute; left: 182px; top: 353px;">
    <div class="rect1"></div>
    <div class="rect2"></div>
    <div class="rect3"></div>
    <div class="rect4"></div>
    <div class="rect5"></div>
   </div>
  </div> 
  <header class="head head_ff5001">
   <div class="title">
    邀请
   </div> 
   <div class="fr"></div> 
  </header>
  <img id="img" onerror='createCode()'>
  <div class="content invite_content"> 
   <div class="banner"> 
    <div class="img" style="background-image: url(./invitation/yq_banner.jpg);"></div> 
   </div> 
   <div class="way_box putong_member"> 
    <div class="in_title clearfix"> 
     <span class="fl">普通会员奖励方式<b></b></span> 
    </div> 
    <div class="con"> 
     <span class="jinbi_icon"></span> 
     <p> <i class="icon_num">1</i>每邀请徒弟奖励0.1元. </p>
     <p> <i class="icon_num">2</i>就是这么简单,就是这么任性. </p>
    </div>
   </div> 
   <div class="way_box vip_member"> 
    <div class="in_title clearfix"> 
     <span class="fl">VIP会员奖励方式<b></b></span> 
     <a class="fr btn_up_vip" onclick="openVip()">10元 <label style="color: yellow;font-weight: 600;"> 升级VIP</label></a>
    </div> 
    <div class="tips mas_tips" style="margin-bottom: .32rem;"> 
     <p>你邀请的好友=你的徒弟 你徒弟邀请的徒弟=你的徒孙，你徒孙邀请的徒弟=你的重孙。</p> 
    </div> 
    <div class="con"> 
     <span class="jinbi_icon"></span> 
     <div class="table_th"> 
      <table> 
       <tbody>
        <tr> 
         <th>我的邀请</th> 
         <th class="null_th"> <img src="./invitation/jiantou.png" /></th> 
         <th>我的邀请</th> 
         <th class="null_th"> <img src="./invitation/jia_icon.png" /></th> 
         <th>升级VIP</th> 
        </tr> 
       </tbody>
      </table> 
     </div> 
     <div class="table_td"> 
      <table> 
       <tbody>
        <tr> 
         <td class="c_000">徒弟</td> 
         <td class="null_th"></td> 
         <td>0.1元</td>
         <td class="null_th"></td> 
         <td>5元</td> 
        </tr> 
        <tr> 
         <td class="c_000">隔代(12)</td>
         <td></td> 
         <td>0.05元</td>
         <td></td> 
         <td>0.5元</td>
        </tr> 
       </tbody>
      </table> 
     </div> 
    </div> 
    <div class="tips"> 
     <p> 注：自己要保持是VIP会员才可以领取VIP会员奖，徒弟、徒孙 每次续费VIP，你都能得到对应奖励。 </p> 
    </div> 
   </div> 
   <div class="invite_btn" onclick="shareLink()">
    <a> <img src="./invitation/yq_btn.png" /></a>
   </div> 
  </div>  

 </body>
</html>